function e(e, t, a) {
    return t in e ? Object.defineProperty(e, t, {
        value: a,
        enumerable: !0,
        configurable: !0,
        writable: !0
    }) : e[t] = a, e;
}

var t = getApp();

require("../../../../component/WxNotificationCenter/WxNotificationCenter.js");

Page({
    data: {
        placeholder: "",
        maxSize: 14,
        content: "",
        teamId: "",
        key: "",
        textareHeight: 250
    },
    onLoad: function(e) {
        var a = wx.getStorageSync(t.storage.teamInfo), n = e.type, o = "", i = 14, c = "", s = "", r = 250;
        console.log(a), 0 == n ? (o = "团队名称", c = a.name, s = "name", r = 160) : 1 == n ? (o = "客服电话", 
        i = 20, s = "phone", c = a.phone) : 2 == n ? (o = "团队地址", i = 50, c = a.address, 
        s = "address") : 3 == n ? (o = "团队简介", i = 1e3, c = a.intro, s = "intro") : 4 == n && (o = "价格说明", 
        i = 1e3, c = a.priceDesc, s = "priceDesc"), console.log(i), wx.setNavigationBarTitle({
            title: o
        }), console.log(c), this.setData({
            maxSize: i,
            content: c,
            teamId: a.teamId,
            key: s,
            textareHeight: r
        });
    },
    inputChange: function(e, t) {
        this.setData({
            content: e.detail.content
        });
    },
    clickSave: function(e) {
        this.updateData();
    },
    clickAvatar: function(e) {
        wx.chooseImage({
            count: 1,
            sizeType: [ "compressed" ],
            sourceType: [ "album", "camera" ],
            success: function(e) {
                var t = e.tempFilePaths[0];
                wx.redirectTo({
                    url: "upload/upload?src=" + t
                });
            }
        });
    },
    updateData: function() {
        var a = this;
        t.network.post({
            url: t.url.editTeamInfoNoImage,
            params: e({
                id: a.data.teamId
            }, this.data.key, a.data.content),
            before: function() {
                wx.showLoading({
                    title: "正在修改"
                }), wx.showNavigationBarLoading();
            },
            success: function(e) {
                wx.hideLoading(), t.util.showToast(e.data.message), 1 == e.data.result && setTimeout(function() {
                    var e = getCurrentPages();
                    e[e.length - 2].setData({
                        needUpdate: !0
                    }), wx.navigateBack({});
                }, 1200);
            },
            fail: function() {
                t.hideLoading(), t.util.showToast("获取团队信息失败");
            },
            complete: function() {
                wx.hideNavigationBarLoading();
            }
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {}
});